Skip to content

Spell perPage the same way in every paginated tool - #3142

Open
karpovantonme wants to merge 2 commits into
github:mainfrom
karpovantonme:fix-actions-list-perpage
Open

Spell perPage the same way in every paginated tool#3142
karpovantonme wants to merge 2 commits into
github:mainfrom
karpovantonme:fix-actions-list-perpage

Conversation

@karpovantonme

@karpovantonme karpovantonme commented Aug 22, 2026

Copy link
Copy Markdown

Summary

actions_list advertised per_page while the handler reads pagination through OptionalPaginationParams, which looks for perPage, so whatever the client sent was dropped and the size fell back to 30. projects_list advertises per_page too and its handlers do read that name, so it works, but it left one tool spelling pagination differently from the other 30 and that is the gap the actions_list bug slipped through.

Why

Both schemas now say perPage, and a test keeps the rest of the inventory from drifting the same way.

I went over the full inventory rather than grepping for one string: 32 of the 117 tools advertise pagination, 30 of them get it from WithPagination / WithCursorPagination / WithUnifiedPagination, and these two are the only places where the properties are written out by hand. after_id and before_id on the sub-issue tools are positions rather than pagination, so the test leaves them be.

What changed

  • pkg/github/actions.go: per_page -> perPage in the actions_list schema
  • pkg/github/projects.go: same in the projects_list schema, and the three handlers read it through one helper. per_page is still read when perPage is absent, since the projects tools have advertised that name since September 2025 and clients sending it get the size they ask for today
  • pkg/github/tools_validation_test.go: TestAllToolInputSchemasUseCanonicalPaginationNames walks AllTools and rejects case and underscore variants of page, perPage, after and before. On main it fails on exactly these two tools
  • pkg/github/projects_test.go: covers the helper -- perPage, legacy per_page, both together, neither
  • snapshots regenerated with UPDATE_TOOLSNAPS=true, README with script/generate-docs

The per_page fallback in projects is the one judgement call in here. Drop those three lines if you would rather make it a clean break, the test stays green either way

MCP impact

  • Tool schema or behavior changed

Two properties renamed. actions_list clients sending per_page were already being ignored, and projects_list clients sending it keep working through the fallback.

Prompts tested (tool changes only)

  • "List the most recent workflow run in github/github-mcp-server" -- the case that was silently returning 30 items. Over stdio against this branch, perPage: 1 comes back with 1 run and per_page: 1 with 30, byte for byte the same response as sending no page size at all
  • I did not exercise projects_list over stdio, no project at hand. Test_optionalProjectsPerPage covers the four cases instead

Security / limits

  • No security or limits impact

Tool renaming

  • I am not renaming tools as part of this PR

Lint & tests

  • Linted locally with ./script/lint
  • Tested locally with ./script/test

Docs

  • Updated (README / docs / examples)

@karpovantonme
karpovantonme requested a review from a team as a code owner August 22, 2026 20:49
@SamMorrowDrums

Copy link
Copy Markdown
Collaborator

Can you make sure all schema advertised per_page entries are handled, I think there might be some others, and we should be totally consistent to reduce chances of bugs like this occuring.

The schema declared per_page while the handler reads pagination through
OptionalPaginationParams, which looks for perPage, so the value was
always dropped and perPage fell back to the default 30.
projects_list advertised per_page while every other paginated tool
advertises perPage. The handlers read per_page, so it worked, but it left
one tool spelling pagination differently from the other 30 and that is how
actions_list ended up advertising a name nothing read.

The schema now says perPage. per_page is still read when perPage is absent:
the projects tools have advertised it since September 2025 and clients
sending it get the size they ask for today.

TestAllToolInputSchemasUseCanonicalPaginationNames walks the whole tool
inventory and rejects case and underscore variants of page, perPage, after
and before. On main it fails on actions_list and projects_list.
@karpovantonme
karpovantonme force-pushed the fix-actions-list-perpage branch from efc5778 to 2c4b2a3 Compare August 27, 2026 15:14
@karpovantonme karpovantonme changed the title Fix perPage parameter name in actions_list schema Spell perPage the same way in every paginated tool Aug 27, 2026
@karpovantonme

Copy link
Copy Markdown
Author

Went through the whole inventory rather than grepping for the string: 32 of the 117 tools advertise pagination, 30 of them get it from WithPagination / WithCursorPagination / WithUnifiedPagination, and actions_list and projects_list are the only two that write the properties out by hand. projects_list does read per_page back under the same name so it works, but it was the other tool spelling pagination its own way, so it is in this PR now -- schema says perPage, with per_page still read when perPage is absent, since the projects tools have advertised that name since Sept 2025.

For the "reduce chances of bugs like this occurring" part I put the check next to your combinator guard in tools_validation_test.go: it walks AllTools and rejects case and underscore variants of page, perPage, after and before. On main it fails on exactly those two tools. Having the inventory-wide file already there meant the guard was a small addition rather than new scaffolding.

The per_page fallback in projects is the one judgement call in here -- drop those three lines if you would rather have a clean break, the test is green either way

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants